package com.jic.member.mapper;

import java.lang.Long;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.jic.member.entity.MememberUser;
import com.jic.member.request.LabelRequest;
import com.jic.member.request.MememberUserRequest;
import com.jic.member.response.MememberUserResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * 会员信息表
 *
 * @author :
 * @version : v1.0.0
 * @email :
 * @since : 2020-04-16 11:20:10
 */
@Mapper
@Repository
public interface MememberUserMapper {

    long insert(MememberUser mememberUser);

    long delete(Long id);

    long update(MememberUser mememberUser);

    MememberUser queryByPrimaryKey(Long id);

    List<MememberUser> query(MememberUser mememberUser);

    /**
     * 查询会员列表
     * 需要注意的是【mem_member_user】表中的dept_id是无效的；所以关联的【mem_member_action】表来锁定平台Id；
     * @param mememberUser 请求入参
     * @return 返回封装的实体来
     * @author tzc
     * @date 2020-7-10 19:31:51
     */
    List<MememberUser> listMemberUserInfoInDeptIds(MememberUser mememberUser);


    List<MememberUser> queryPage(@Param("startIndex") int startIndex, @Param("limit") int limit, @Param("mememberUser") MememberUser mememberUser);

    long queryPageCount(@Param("mememberUser") MememberUser mememberUser);

    /**
     * 查询性别会员ID
     *
     * @param labelRequest
     * @return
     */
    List<String> querySexBatchByEnumsIds(LabelRequest labelRequest);

    /**
     * 查询会员类型等级会员Id
     *
     * @param labelRequest
     * @return
     */
    List<String> queryGradeBatchByEnumsIds(LabelRequest labelRequest);

    /**
     * 查询会员类型会员Id
     *
     * @param labelRequest
     * @return
     */
    List<String> queryTypeBatchByEnumsIds(LabelRequest labelRequest);

    /**
     * 查询年龄类型会员Id
     *
     * @param labelRequest
     * @return
     */
    List<String> queryAgeBatchByEnumsIds(LabelRequest labelRequest);

    /**
     * description: 查询会员手机号码
     *
     * @author: jackHe
     * @time: 2020/6/30 16:02
     */
    List<MememberUser> queryUserInfoByPhone(MememberUser mememberUser);


    /**
     * 为活动中心提供会员列表接口
     * @param deptIdArr 平台Id数组
     * @param levelCodeArr 等级编码数组
     * @param memberTypeArr 会员类型数组
     * @param memberGradeIdArr 会员等级主键数组
     * @return 响应参数
     * @author tzc
     * @date 2020-7-2 22:07:45
     */
    List<MememberUser>  listMemberUserInfoForMarket(@Param("deptIdArr") Long[] deptIdArr,
                                           @Param("levelCodeArr") String[] levelCodeArr,
                                           @Param("memberTypeArr") Long[] memberTypeArr,
                                           @Param("memberGradeIdArr") Long[] memberGradeIdArr,
                                            @Param("deptType") String deptType
                                            );

    List<MememberUserResponse> queryMemberListByPhone(@Param("phoneList") String phoneList);


    List<MememberUser> listRestPage(@Param("startIndex") int startIndex, @Param("limit") int limit, @Param("mememberUser") MememberUser mememberUser);

    long listRestPageCount(@Param("mememberUser") MememberUser mememberUser);

    List<MememberUser> listPage(MememberUserRequest mememberUserRequest);

    Long updateMember(MememberUserRequest request);

    List<Map<String, Object>> queryRegisteredCount(MememberUserRequest request);

    List<MememberUser> queryRegistered(MememberUserRequest request);

    Integer updateStatus(MememberUserRequest form);

    List<MememberUser> count();

    /**
     *
     *
     * @description: 修改白名单状态
     * @return:
     * @author: fengrui
     * @time: 2020/12/08 22:39
     */
    Integer updateMemberStatus(@Param("date") Date date);

    Integer updateMemberGray(@Param("list") List<String> list);
}
